package com.zheng.current;

import com.zheng.current.controller.TestController;
import com.zheng.current.dto.Task;
import com.zheng.current.dto.WrapFlightQuery;
import lombok.AllArgsConstructor;
import lombok.Builder;
import lombok.Data;
import lombok.NoArgsConstructor;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import java.util.Map;
import java.util.concurrent.Callable;

/**
 * @version 1.0
 * @Copyright (c) 合思技术团队 https://www.hosecloud.com/
 * @Package com.zheng.current
 * @Project：base-test4-mysql-master
 * @authur：zhengtianliang@hosecloud.com
 * @date：2025/6/16 17:55
 * @Desc:  继承了Callbale接口，重写了call方法
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
@Builder
public class ParallelTasker implements Callable<Map<String,Object>> {
    private Logger logger = LoggerFactory.getLogger(ParallelTasker.class);

    /**
     * 查询条件
     */
    private WrapFlightQuery condition;

    /**
     *任务类型
     */
    private Task category;




    @Override
    public Map<String,Object> call() throws Exception {
        long start = System.currentTimeMillis();

        logger.info("ParallelTasker call start");
        Map<String, Object> execute = FlightMultiChannelParallelQueryFactory.getTaskConsolidationManager(category).execute(condition);
        logger.info("ParallelTasker call end",(System.currentTimeMillis()-start)/1000);
        return execute;
    }
}
